package ru.stepuk.modeller.buffers;

import java.util.List;
import ru.stepuk.modeller.Request;

/**
 *
 * @author Ivan Stepuk
 */
public abstract class Buffer {

    protected int capacity;
    protected List<Request> container;

    public abstract void putRequest(Request request) throws FullQueueException;

    public abstract Request getRequest();

    public boolean hasFreeSpace() {
        if (capacity == 0) {
            return true;
        }
        return container.size() < capacity;
    }

    public boolean isEmpty() {
        return container.isEmpty();
    }

    public void clear() {
        container.clear();
    }

    public int getCapacity() {
        return capacity;
    }

    public int getSize() {
        return container.size();
    }
}
